
//--------------XMLHttpRequest---------------------// 
  function GetXmlHttpObject(){
   var xmlhttp = false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e2) {
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
  }
  
//------------信息不为能为空检测-----------//
  function checkUserName(obj)
  {
	  if(obj.value.length<1){
		obj.calssName = "FrameDivWarn";
		showInfo("username_notice", msg_not_null);
		change_submit("true");
	  }else{
		showInfo("username_notice", info_right);
		change_submit("false");
	  }
  }
  
  function checkAddress(obj)
  {
	  if(obj.value.length<1){
		obj.calssName = "FrameDivWarn";
		showInfo("address_notice", msg_not_null);
		change_submit("true");
	  }else{
		showInfo("address_notice", info_right);
		change_submit("false");
	  }
  }
  
  function checkZip(obj)
  {
	  if(obj.value.length<1){
		obj.calssName = "FrameDivWarn";
		showInfo("zip_notice", msg_not_null);
		change_submit("true");
	  }else{
		showInfo("zip_notice", info_right);
		change_submit("false");
	  }
  }
  
  
//---------Email检测-------//  
  function checkEmail(obj)
  {
     if (chekEmailFormat(obj.value)==false)

    {
  	   obj.className = "FrameDivWarn";
  	   showInfo("email_notice",msg_email_format);
  	   change_submit("true");  
   } else
     {
	    obj.className = "FrameDivPass";
		showInfo("email_notice",info_right);
	    change_submit("false");
     }
  }
  
  function chekEmailFormat(email) {  
	  var pattern = /^[a-za-z0-9_-]+@[a-za-z0-9_-]+(\.[a-za-z0-9_-]+)+$/;  
	  if(pattern.test(email)) {  
	   return true;  
	  }  
	  else {  
	   return false;  
	  }  
 }
 
//-----------TEL检测--------------------------------// 
  function checkTel(Tel)
  {
   if (chektel(Tel.value)==false)

    {
      Tel.className = "FrameDivWarn";
  	showInfo("tel_notice",msg_tel_format);
  	change_submit("true");  
   } 
  else
     {
     showInfo("tel_notice",info_right);
     Tel.className = "FrameDivPass";
     change_submit("false"); 
     }
  }

  function chektel(Tel) {  
   var pattern = /(^(1[3|4|5|8][0-9]\d{8}$)|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/;
   if(pattern.test(Tel)) {  
    return true;  
   }  
   else {  
    return false;  
   }  
  } 
  
  
  
//------------按钮状态设置-----------------------------//
  function change_submit(zt)
  { 
       if (zt == "true")
       {
        document.forms['orderinfo'].elements['ordersubmit'].disabled = 'disabled';
       }
     else
       {
  	    document.forms['orderinfo'].elements['ordersubmit'].disabled = '';
       }
  }
  //------公用程序------------------------------------//
  function showInfo(target,Infos){
	  document.getElementById(target).innerHTML = Infos;
  }
  function showclass(target,Infos){
	  document.getElementById(target).className = Infos;
  }
  
  var msg_email_blank = "<span style='COLOR:#ff0000'> <img src='/NCP/images/register/no.gif' width='16' height='16' border='0' align='absmiddle' /> 邮件地址不能为空！</span>";
  var msg_email_registered = " <span style='COLOR:#ff0000'> <img src='/NCP/images/register/no.gif' width='16' height='16' border='0' align='absmiddle' /> 邮箱已存在,请重新输入！</span>";
  var msg_email_format = "<span style='COLOR:#ff0000'> <img src='/NCP/images/register/no.gif' width='16' height='16' border='0' align='absmiddle' /> 邮件地址不合法！</span>";
  var msg_tel_format="<span style='COLOR:#ff0000'> <img src='/NCP/images/register/no.gif' width='16' height='16' border='0' align='absmiddle' /> 联系电话格式不正确!</span>";
  var info_right="<span style='COLOR:#006600'> <img src='/NCP/images/register/yes.gif' width='16' height='16' border='0' align='absmiddle' /> 填写正确！</span>";
  var msg_not_null = "<span style='COLOR:#ff0000'> <img src='/NCP/images/register/no.gif' width='16' height='16' border='0' align='absmiddle' /> 不能为空！</span>";